package com.bbms.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.bbms.dao.BookCategoryDAO;
import com.bbms.entity.BookCategory;
import com.bbms.entity.Page;
import com.bbms.service.BookCategoryService;

/**
 * @author Administrator
 * 图书类型业务管理实现类
 */
@Service("BookCategoryServiceImpl")
public class BookCategoryServiceImpl implements BookCategoryService {
	
	@Resource(name = "BookCategoryDAOImpl")
	private BookCategoryDAO dao;
	
	public BookCategoryServiceImpl() {
		super();
	}

	/* 新增图书类型业务
	 * @see com.bbms.service.BaseService#add(java.lang.Object)
	 */
	@Override
	public void add(BookCategory t) {
		dao.save(t);
	}

	/* 更新图书类型业务
	 * @see com.bbms.service.BaseService#update(java.lang.Object)
	 */
	@Override
	public void update(BookCategory t) {
		dao.update(t);
		
	}

	/* 删除图书类型业务
	 * @see com.bbms.service.BaseService#delete(java.lang.Object)
	 */
	@Override
	public void delete(BookCategory t) {
		dao.delete(t);
	}

	/* 获取分页数据业务
	 * @see com.bbms.service.BaseService#query(int, int)
	 */
	@Override
	public Page getPage(int currentPage, int pageSize) {
		
		Page page = dao.getPage(currentPage, pageSize);
		
		return page;
		
	}

	/* 获取所有图书类型业务
	 * @see com.bbms.service.BookCategoryService#getAll()
	 */
	@Override
	public Object getAllData() {
		
		Object o = JSON.toJSON(dao.query());
		
		return o;
	}
	
	
}
